package demo3;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Person {
//    @Autowired
//    private  Sweater sweater;
//    @Autowired
//    private Shirt shirt;

    @Autowired
    @Qualifier("summer")
     Clothes clothes;

    public void play(){

//        Sweater sweater = new Sweater();
//        sweater.wear();

        //如果更换其他类，这需要修改代码
//        Shirt shirt = new Shirt();
//        shirt.wear();

        clothes.wear();
        System.out.println("出去玩");
    }
}
